Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autocomplete updateOn blur on select (#16805) #16828

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SpeederX
Copy link

@SpeederX SpeederX commented Nov 24, 2024

Related issue

Issue reported here #16805

Changes rationale

To handle updateOn setup with blur value, the following changes have been made:

  1. Adapting the onInputBlur conditionally calling onModelTouched only if forceSelection is false.
  2. Adding onModelTouched call in the onSelect ( unconditionally ), which provides the FormControl / FormGroup the value selected by the user, without considering the text input the user is searching ( unless forceSelection is false ).

Additional notes

This way was chosen because NG_VALUE_ACCESSOR updates the ancestor calling registerOnTouched which by angular docs:

When implementing registerOnTouched in your own value accessor, save the given function so your class calls it when the control should be considered blurred or "touched"

If forceSelection is set to false and updateOn is set as blur, upon both user input text / search and when user selects an option, the FormControl and FormGroup will be updated.

Copy link

vercel bot commented Nov 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Nov 24, 2024 8:43pm

Copy link

vercel bot commented Nov 24, 2024

@SpeederX is attempting to deploy a commit to the primetek Team on Vercel.

A member of the Team first needs to authorize it.

@SpeederX
Copy link
Author

Does the link to the issue must be defined during the PR opening or can be done afterwards? I see others have the issue linked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant